#pragma once

#include <QWidget>
#include "ui_downloadwidget.h"
#include <qthread.h>

#include "ksongwebinfo.h"
#include "downloadthreadtask.h"

class DownloadWidget : public QWidget
{
	Q_OBJECT

public:
	DownloadWidget(const KSongWebInfo* songInfo,QWidget *parent = nullptr);
	~DownloadWidget();

	void onHandleStartBtnClciked();
	void onHandleSetBtnClicked();
	void onHandleProgressUpdated(int progress);
	void onHandleFinished();
signals:
	void startTask();
	void endTask();

private:
	QString saveFileName();

	
	const static QString DEFAULT_SAVE_PATH;
	Ui::DownloadWidgetClass ui;
	DownloadThreadTask* m_task;
	QThread m_taskThread;
	QString m_downloadURL;
	QString m_savePath;
	QString m_fileName;
};
